package com.aceleeyy.apb.exception;

import com.aceleeyy.apb.base.ApbStatus;
import lombok.Data;

/**
 * API-自定义异常
 *
 * @author Ace Lee
 * @version 1.0
 * @date 2020/8/10 10:41
 **/
@Data
public class ApbException extends RuntimeException {
    private Integer code;

    public ApbException(Integer code, String message) {
        super(message);
        this.code = code;
    }

    public ApbException(ApbStatus apbStatus) {
        super(apbStatus.desc());
        this.code = apbStatus.code();
    }

    @Override
    public String toString() {
        return "CMSException{" + "code=" + code + ", message=" + this.getMessage() + '}';
    }
}